<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">











<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>JDBCProxy Framework - Introduction</title>
    <style type="text/css" media="all">
      @import url("./css/maven-base.css");
      @import url("./css/maven-theme.css");
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
          <meta name="author" content="Dave W." />
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
      </head>
  <body class="composite">
    <div id="banner">
                    <span id="bannerLeft">
    
            JDBCProxy Framework
    
            </span>
                          <span id="bannerRight">
    
            Big-Oh Software ... computer scientists find big-oh!!
    
            </span>
            <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="breadcrumbs">
          
  

  
    
            
  
    
            <div class="xleft">
        Version: 2.4
              </div>
            <div class="xright">      
  

  
    
            
  
    
             Last Published: 2010-08-08
            </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
           
  

  
    
            
  
    
                   <h5>Project Documentation</h5>
            <ul>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-info.html">Project Information</a>
                </li>
              
                
              
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
            
      
              
        <li class="collapsed">
                    <a href="project-reports.html">Project Reports</a>
                </li>
          </ul>
                                           <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
            <img alt="Built by Maven" src="./images/logos/maven-feather.png"></img>
          </a>
                       
  

  
    
            
  
    
        </div>
    </div>
    <div id="bodyColumn">
      <div id="contentBox">
        <div class="section"><h2>Overview</h2>
<p>A JDBC Driver proxy can be utilized to unobtrusively observe the database events produced by a Java application. Observing those JDBC events makes it easy to add new types of persistence-related functionality. Here are just a few examples of the features that you might add to your application using a JDBC Driver proxy.</p>
<ul><li>Log all SQL statements executed by the application.</li>
<li>Prevent the execution of malicious or ill-conceived SQL statements.</li>
<li>Track the least performant SQL statements run by the application.</li>
</ul>
<p>Note that each of the features described in the list above can be applied to an existing Java application without changing the application's code. As a result, the JDBCProxy framework allows developers to add new features unobtrusively! Read on to the next section to see how.</p>
</div>
<div class="section"><h2>Usage</h2>
<p>The JDBCProxy framework provides a single driver class, JdbcDriverProxy, that builds itself by reading a list of event listeners from a file in the classpath named jdbcdriverproxy.properties. Here's an example:</p>
<div class="source"><pre>#jdbcdriverproxy.properties
JDBCEventListeners=net.big_oh.common.jdbc.event.listener.logger.JDBCCommonsLoggingListener,\
net.big_oh.common.jdbc.event.listener.safety.JDBCSafetyListener </pre>
</div>
<p>Note that although the example properties file listed above makes use of the predefined event listeners from the net.big_oh.common.jdbc.listener package, you are also free to include your own custom JDBC event listeners. Once you've configured your jdbcdriverproxy.properties file, making use of the Driver proxy is easy.</p>
<div class="source"><pre>Class.forName(&quot;net.big_oh.common.jdbc.JdbcDriverProxy&quot;);
String url = JdbcDriverProxy.class.getSimpleName() + &quot;:&quot; + &quot;jdbc:postgresql://localhost:5432/[your_schema]&quot;;
Connection con = DriverManager.getConnection(url, &quot;[your_username]&quot;, &quot;[your_password]&quot;);        </pre>
</div>
<p>Using the syntax above will cause JDBC events to be delivered to all registered listeners defined in the properties file.</p>
</div>

      </div>
    </div>
    <div class="clear">
      <hr/>
    </div>
    <div id="footer">
      <div class="xright">&#169;  
          2008-2010
    
          Big-Oh Software
          
  

  
    
            
  
    
  </div>
      <div class="clear">
        <hr/>
      </div>
    </div>
  </body>
</html>
